home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Add-Ons
/
4D
/
ComboBox 1.1.1
/
src
/
ComboBox.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-02-23
|
24KB
|
714 lines
//---------------------------------------------------------------------------------------
//
// ComboBox.c -- Source for ComboBox external area
//
// Copyright ©1995-1996, Pensacola Christian College
//
// ======================================================================
// Change History
// ======================================================================
//
// 1.0 08/ /95 Steve Dwire
// Initial release
//
// 1.0.1 10/18/95 Steve Dwire
// Fixed problem with unlocked PackData handle in LaunchListProcess()
// Default PICT resource IDs changed to reflect new PICTs
//
// 1.1 11/28/95 Steve Dwire
// Added handler for kCB_GetFontNum
//
// 11/28/95 Steve Dwire
// Added AreaStruct() function to draw area in layout editor.
//
// 1.1.1a2 02/23/96 Steve Dwire
// Fix dumb mistake in AreaStruct() that caused some text fields
// to be displayed incorrectly.
//
//---------------------------------------------------------------------------------------
#include <Ext4D.h>
#include <Palettes.h>
#include "ComboBoxMain.h" // Include your header here.
#if defined(powerc) || WINVER
#include "ComboBoxList.h"
#endif
//---------------------------------------------------------------------------------
//
// FUNCTION: {Main/FourDPack/main}
//
//---------------------------------------------------------------------------------
//The main entry point
//This the main entry point of the package.
#if defined(powerc)
pascal void Main(SLONG entryPoint, PackagePtr params, PackHnd *PackData, ResultPtr result){
#else
#if WINVER
void pascal FourDPack(SLONG entryPoint, PackagePtr params, PackHnd *PackData, ResultPtr result){
#else
pascal void main(SLONG entryPoint, PackagePtr params, PackHnd *PackData, ResultPtr result){
#endif
#endif
OSErr err;
//Do we have a package data handle?
if(*PackData)
switch(entryPoint)
{
case kDeinitPackage:
// Dispose any memory taken by members of package data block.
DisposeHandle((Handle)*PackData);
break;
//For each item in the STR# there is an entry in the package entrypoint.
//The entrypoints and their parameters are handled regarding the contents of the main STR#.
case k_MyAreaProc:
switch(((EventRecord*)(params[0]))->what)
{
//•Remove or comment the next three lines if you want to handle kIdleEvt in your area
//case kIdleEvt:
// err = noErr;
// break;
case kInitEvt:
err = InitAreaData((AreaHnd*)params[3],*PackData,(Rect*)params[1],(EventRecord*)(params[0]));
break;
case kDeInitEvt:
// Dispose any memory taken by members of area’s data block.
if((**PackData)->CurrAreaHnd == *(AreaHnd*)params[3])
(**PackData)->CurrAreaHnd = NULL;
DeInitAreaData(*((AreaHnd*)params[3]));
DisposeHandle(*((Handle*)params[3]));
//•If cannot DeInit, uncomment next two lines.
//if(event->message == kCanRefuse)
// event->message = kZoneRefuseDeInit;
break;
case kStructEvt:
(**((AreaHnd*)params[3]))->MyLytType = kDesign;
//•Draw the area image on the layout design window
//v1.1
// added the following line:
AreaStruct((UBYTE*)params[2], (Rect*)params[1], *PackData);
// to draw the area in the layout editor. It must go here rather than in ComboBoxArea.c,
// because I want to use the default settings the programmer has set (Using CB_SetDefXxx).
// In order to do that, I must have a handle to the Package Data. I can't get it from
// the design environment using GetPackDataHnd() because no variables are defined in the
// design environment, therefore, I can't read CB_PackData. I must have the Package Data
// Handle passed in directly, as it is here.
((EventRecord*)(params[0]))->message = kZoneIsCustomized;
break;
default:
err = Area((EventRecord*)params[0],
(Rect*)params[1],
(UBYTE*)params[2],
(AreaHnd*)params[3]);
}//•Include one case for each routine in your package.
break;
case kCB_SetDefTxtFnt:
CB_SetDefTxtFnt(*PackData,*(SWORD*)params[0],*(SWORD*)params[1],*(SWORD*)params[2]);
break;
case kCB_SetDefTxtCol:
CB_SetDefTxtCol(*PackData,*(SWORD*)params[0],*(SWORD*)params[1]);
break;
case kCB_SetDefLstFnt:
CB_SetDefLstFnt(*PackData,*(SWORD*)params[0],*(SWORD*)params[1],*(SWORD*)params[2]);
break;
case kCB_SetDefLstCol:
CB_SetDefLstCol(*PackData,*(SWORD*)params[0],*(SWORD*)params[1]);
break;
case kCB_SetDefLstRws:
CB_SetDefLstRws(*PackData,*(SWORD*)params[0]);
break;
case kCB_SetDefPopPic:
CB_SetDefPopPic(*PackData,*(SWORD*)params[0],*(SWORD*)params[1],*(SWORD*)params[2],
*(SWORD*)params[3],*(SWORD*)params[4],*(SWORD*)params[5]);
break;
case kCB_SetDefGap:
CB_SetDefGap(*PackData,*(SWORD*)params[0],*(SWORD*)params[1],
*(SWORD*)params[2],*(SWORD*)params[3]);
break;
case kCB_SetDefLead:
CB_SetDefLead(*PackData,*(SWORD*)params[0]);
break;
case kCB_SetDefFlags:
CB_SetDefFlags(*PackData,*(SWORD*)params[0],*(SWORD*)params[1],
*(SWORD*)params[2],*(SWORD*)params[3],
*(SWORD*)params[4],*(SWORD*)params[5]);
break;
case kCB_SetTxtFnt:
CB_SetTxtFnt(*(AreaHnd*)params[0],*(SWORD*)params[1],*(SWORD*)params[2],
*(SWORD*)params[3]);
break;
case kCB_SetTxtCol:
CB_SetTxtCol(*(AreaHnd*)params[0],*(SWORD*)params[1],*(SWORD*)params[2]);
break;
case kCB_SetLstFnt:
CB_SetLstFnt(*(AreaHnd*)params[0],*(SWORD*)params[1],*(SWORD*)params[2],
*(SWORD*)params[3]);
break;
case kCB_SetLstCol:
CB_SetLstCol(*(AreaHnd*)params[0],*(SWORD*)params[1],*(SWORD*)params[2]);
break;
case kCB_SetLstRws:
CB_SetLstRws(*(AreaHnd*)params[0],*(SWORD*)params[1]);
break;
case kCB_GetLstRws:
*((SLONG*)result) = CB_GetLstRws(*(AreaHnd*)params[0]);
break;
case kCB_SetPopPic:
CB_SetPopPic(*(AreaHnd*)params[0],*(SWORD*)params[1],*(SWORD*)params[2],
*(SWORD*)params[3],*(SWORD*)params[4],
*(SWORD*)params[5],*(SWORD*)params[6]);
break;
case kCB_SetGap:
CB_SetGap(*(AreaHnd*)params[0],*(SWORD*)params[1],*(SWORD*)params[2],
*(SWORD*)params[3],*(SWORD*)params[4]);
break;
case kCB_SetLead:
CB_SetLead(*(AreaHnd*)params[0],*(SWORD*)params[1]);
break;
case kCB_SetFlags:
CB_SetFlags(*(AreaHnd*)params[0],*(SWORD*)params[1],*(SWORD*)params[2],
*(SWORD*)params[3],*(SWORD*)params[4],
*(SWORD*)params[5],*(SWORD*)params[6]);
break;
case kCB_FillLst:
CB_FillLst(*(AreaHnd*)params[0],(UBYTE*)params[1]);
break;
case kCB_UpdateLst:
CB_UpdateLst(*(AreaHnd*)params[0]);
break;
case kCB_SetLstPos:
CB_SetLstPos(*(AreaHnd*)params[0],*(SWORD*)params[1]);
break;
case kCB_GetLstPos:
*((SLONG*)result) = CB_GetLstPos(*(AreaHnd*)params[0]);
break;
case kCB_SetTxt:
CB_SetTxt(*(AreaHnd*)params[0],(TextBlock*)params[1]);
break;
case kCB_GetTxt:
CB_GetTxt(*(AreaHnd*)params[0],(TextBlock*)params[1]);
break;
case kCB_SetModified:
CB_SetModified(*(AreaHnd*)params[0],*(SWORD*)params[1]);
break;
case kCB_GetModified:
*((SLONG*)result) = CB_GetModified(*(AreaHnd*)params[0]);
break;
case kCB_SetEnabled:
CB_SetEnabled(*(AreaHnd*)params[0],*(SWORD*)params[1]);
break;
case kCB_GetEnabled:
*((SLONG*)result) = CB_GetEnabled(*(AreaHnd*)params[0]);
break;
case kCB_SetHilite:
CB_SetHilite(*(AreaHnd*)params[0],*(SWORD*)params[1],*(SWORD*)params[2]);
break;
case kCB_GetHilite:
CB_GetHilite(*(AreaHnd*)params[0],(SWORD*)params[1],(SWORD*)params[2]);
break;
//v1.1
// Added following lines:
case kCB_GetFontNum:
*((SLONG*)result) = CB_GetFontNum((UBYTE*)params[0]);
break;
// to handle CB_GetFontNum function
}
//If we don’t have a package data block we must create one
else
{
switch(entryPoint)
{
case kInitPackage:
// Let's create the package datas…
*PackData = (PackHnd)NewHandleClear(sizeof(PackStr));
InitExtension(params); //call standard initialization routine in ExtRoutines.c
if (*PackData)
{
//•Allocate and initialize any memory needed by members of package data block.
HLock((Handle)*PackData);
InitPackageData(*PackData);
LaunchListProcess(*PackData);
HUnlock((Handle)*PackData);
}
break;
}
}
}
//---------------------------------------------------------------------------------
//
// FUNCTION: InitPackageData
//
//---------------------------------------------------------------------------------
void InitPackageData(PackHnd PackData)
{
PackPtr PackDataPtr;
ParameterBlock block;
ValuePtr value;
// Store the handle to our package data in interprocess variable ◊CB_PackData
// We do this so that our other process (the one that handles the list window)
// can look at the CurrAreaHnd element to know which area it's supposed to be
// working on now.
//For some reason, the compiler doesn't seem to like string literals, so I do
//it this slow way.
block.fName[0] = (SBYTE)11; // It's supposed to be a pascal string.
block.fName[1] = 'C';
block.fName[2] = 'B';
block.fName[3] = '_';
block.fName[4] = 'P';
block.fName[5] = 'a';
block.fName[6] = 'c';
block.fName[7] = 'k';
block.fName[8] = 'D';
block.fName[9] = 'a';
block.fName[10] = 't';
block.fName[11] = 'a';
block.fName[12] = '\0'; // just in case something looks at it C-Style.
value = (ValuePtr) NewPtr(sizeof(ValueBlock));
value->fType = eLongint;
value->uValue.fLongint = (SLONG)PackData;
block.fH = (XHANDLE)value;
CALL4D(kEX_SET_GLOBALVAR,&block);
DisposePtr((Ptr)value);
// Now it's time to actually set up our initial defaults.
HLock((Handle)PackData);
PackDataPtr = *PackData;
//v1.0.1 following lines changed to receive new PICT resources:
PackDataPtr->DefCPICTResUp = GetResID('4BNX','PICT',1);
PackDataPtr->DefCPICTResDn = GetResID('4BNX','PICT',2);
PackDataPtr->DefCPICTResDis = GetResID('4BNX','PICT',3);
PackDataPtr->DefMPICTResUp = GetResID('4BNX','PICT',4);
PackDataPtr->DefMPICTResDn = GetResID('4BNX','PICT',5);
PackDataPtr->DefMPICTResDis = GetResID('4BNX','PICT',6);
PackDataPtr->DefTextFont = 1;
PackDataPtr->DefTextSize = 9;
PackDataPtr->DefTextStyle = 0;
PackDataPtr->DefTextFGColor = 15;
PackDataPtr->DefTextBGColor = 0;
PackDataPtr->DefListFont = 1;
PackDataPtr->DefListSize = 9;
PackDataPtr->DefListStyle = 0;
PackDataPtr->DefListFGColor = 15;
PackDataPtr->DefListBGColor = 0;
PackDataPtr->DefListRows = 5;
PackDataPtr->DefPixGap = 0;
PackDataPtr->DefTopGap = 3;
PackDataPtr->DefLeftGap = 0;
PackDataPtr->DefRightGap = 0;
PackDataPtr->DefPixLead = 0;
PackDataPtr->DefFlags.CanFind = true;
PackDataPtr->DefFlags.CanFill = true;
PackDataPtr->DefFlags.CanList = true;
PackDataPtr->DefFlags.CanEdit = true;
PackDataPtr->DefFlags.ListOnActivate = true;
PackDataPtr->DefFlags.ListOnKeystroke = true;
HUnlock((Handle)PackData);
}
//---------------------------------------------------------------------------------
//
// FUNCTION: AreaStruct
//
//---------------------------------------------------------------------------------
void AreaStruct(UBYTE *name, Rect *bounds, PackHnd PackDataHnd)
{
PicHandle ThePICT;
Rect TextRect, PICTRect;
int TopBorder, RightBorder;
FontInfo FntInfo;
GrafPtr CurrGrafPort;
SWORD OldFont, OldSize, OldFace;
ColorSpec OldFore, OldBack;
if (PackDataHnd == NULL)
SysBeep(10);
ThePICT = GetPicture((*PackDataHnd)->DefCPICTResUp);
// Figure out where the default picture goes
if (ThePICT != NULL)
{
PICTRect = (*ThePICT)->picFrame;
}
else
{
PICTRect.top = PICTRect.bottom = PICTRect.left = PICTRect.right = 0;
}
OffsetRect(&PICTRect,-(PICTRect.right),-(PICTRect.top));
OffsetRect(&PICTRect,bounds->right,bounds->top);
TopBorder = (*PackDataHnd)->DefPixLead;
RightBorder = (*PackDataHnd)->DefPixGap + PICTRect.right - PICTRect.left;
GetPort(&CurrGrafPort);
OldFont = CurrGrafPort->txFont;
OldSize = CurrGrafPort->txSize;
OldFace = CurrGrafPort->txFace;
TextFont((*PackDataHnd)->DefTextFont);
TextSize((*PackDataHnd)->DefTextSize);
TextFace((Style)(Byte)(*PackDataHnd)->DefTextStyle);
GetFontInfo(&FntInfo);
TextRect.top = bounds->top + TopBorder;
TextRect.left = bounds->left;
TextRect.bottom = TextRect.top + FntInfo.ascent + FntInfo.descent;
TextRect.right = bounds->right - RightBorder;
SectRect(&TextRect,bounds,&TextRect);
SaveFore(&OldFore);
SaveBack(&OldBack);
if (ThePICT != NULL)
DrawPicture(ThePICT,&PICTRect);
PmForeColor((*PackDataHnd)->DefTextFGColor);
PmBackColor((*PackDataHnd)->DefTextBGColor);
EraseRect(&TextRect);
MoveTo(TextRect.left + 1,TextRect.top + FntInfo.ascent);
DrawString((ConstStr255Param)name);
RestoreFore(&OldFore);
RestoreBack(&OldBack);
TextFont(OldFont);
TextSize(OldSize);
//v1.1.1a2
// change the following line
//TextFace((Style)(Byte)OldSize);
// to:
TextFace((Style)(Byte)OldFace);
// for obvious reasons. <grimace> This bug caused any text displayed after a
// ComboBox in the Design view to be drawn in the wrong place!
}
//---------------------------------------------------------------------------------
//
// FUNCTION: LaunchListProcess
//
//---------------------------------------------------------------------------------
void LaunchListProcess(PackHnd PackData)
{
SBYTE procName[13];
SLONG ListProcID; // v1.0.1 to fix unlocked PackData handle problem
OSErr err;
procName[0] = (SBYTE)12;
procName[1] = '$';
procName[2] = 'C';
procName[3] = 'B';
procName[4] = '_';
procName[5] = 'L';
procName[6] = 'i';
procName[7] = 's';
procName[8] = 't';
procName[9] = 'P';
procName[10] = 'r';
procName[11] = 'o';
procName[12] = 'c';
//v1.0.1 replaced following line:
// err = LaunchProcess(ListProcess,'CBlp',kBaseResID,16000,procName,&((*PackData)->ListProcID));
//with:
err = LaunchProcess(ListProcess,'CBlp',kBaseResID,16000,procName,&ListProcID);
//and added:
(*PackData)->ListProcID = ListProcID;
//because PackData could get moved and the ListProcID would get lost. When that happened,
//AreaShowList() in the main process could not kEX_UNFREEZE it, and no updating occurred.
}
//---------------------------------------------------------------------------------
//
// FUNCTION: InitAreaData
//
//---------------------------------------------------------------------------------
OSErr InitAreaData(AreaHnd* AreaDataHndPtr,PackHnd PackDataHnd,
Rect* AreaRect, EventRecord* event)
{
OSErr err;
AreaPtr AreaDataPtr;
*AreaDataHndPtr = (AreaHnd)NewHandleClear(sizeof(AreaStr));
err = MemError();
if (err == noErr)
{
//•Allocate and initialize any memory needed by members of area data block.
HLock((Handle) *AreaDataHndPtr);
AreaDataPtr = **AreaDataHndPtr;
InitAreaDefaults(AreaDataPtr, PackDataHnd);
AreaDataPtr->isWindow = (event->when == kIsExternalWindow);
AreaDataPtr->isPrinting = (event->message == kIsPrinting);
AreaDataPtr->MyLytType = (event->modifiers == kIsOutputLayout)?kOutput:kInput;
err = InitAreaStructs(AreaDataPtr, AreaRect, PackDataHnd);
HUnlock((Handle) *AreaDataHndPtr);
if (err)
{
DeInitAreaData(*AreaDataHndPtr);
DisposeHandle((Handle) *AreaDataHndPtr);
}
}
return err;
}
//---------------------------------------------------------------------------------
//
// FUNCTION: InitAreaDefaults
//
//---------------------------------------------------------------------------------
void InitAreaDefaults (AreaPtr AreaDataPtr, PackHnd PackDataHnd)
{
PackPtr PackDataPtr;
HLock((Handle) PackDataHnd);
PackDataPtr = *PackDataHnd;
AreaDataPtr->ActivateTick = 0;
AreaDataPtr->CPICTResUp = PackDataPtr->DefCPICTResUp;
AreaDataPtr->CPICTResDn = PackDataPtr->DefCPICTResDn;
AreaDataPtr->CPICTResDis = PackDataPtr->DefCPICTResDis;
AreaDataPtr->MPICTResUp = PackDataPtr->DefMPICTResUp;
AreaDataPtr->MPICTResDn = PackDataPtr->DefMPICTResDn;
AreaDataPtr->MPICTResDis = PackDataPtr->DefMPICTResDis;
AreaDataPtr->TextFont = PackDataPtr->DefTextFont;
AreaDataPtr->TextSize = PackDataPtr->DefTextSize;
AreaDataPtr->TextStyle = PackDataPtr->DefTextStyle;
AreaDataPtr->TextFGColor = PackDataPtr->DefTextFGColor;
AreaDataPtr->TextBGColor = PackDataPtr->DefTextBGColor;
AreaDataPtr->ListFont = PackDataPtr->DefListFont;
AreaDataPtr->ListSize = PackDataPtr->DefListSize;
AreaDataPtr->ListStyle = PackDataPtr->DefListStyle;
AreaDataPtr->ListFGColor = PackDataPtr->DefListFGColor;
AreaDataPtr->ListBGColor = PackDataPtr->DefListBGColor;
AreaDataPtr->ListRows = PackDataPtr->DefListRows;
AreaDataPtr->ListPos = 0;
AreaDataPtr->PixGap = PackDataPtr->DefPixGap;
AreaDataPtr->TopGap = PackDataPtr->DefTopGap;
AreaDataPtr->LeftGap = PackDataPtr->DefLeftGap;
AreaDataPtr->RightGap = PackDataPtr->DefRightGap;
AreaDataPtr->PixLead = PackDataPtr->DefPixLead;
AreaDataPtr->Flags.CanFind = PackDataPtr->DefFlags.CanFind;
AreaDataPtr->Flags.CanFill = PackDataPtr->DefFlags.CanFill;
AreaDataPtr->Flags.CanList = PackDataPtr->DefFlags.CanList;
AreaDataPtr->Flags.CanEdit = PackDataPtr->DefFlags.CanEdit;
AreaDataPtr->Flags.ListOnActivate = PackDataPtr->DefFlags.ListOnActivate;
AreaDataPtr->Flags.ListOnKeystroke = PackDataPtr->DefFlags.ListOnKeystroke;
AreaDataPtr->Flags.Visible = true;
AreaDataPtr->Flags.Active = false;
AreaDataPtr->Flags.Modified = false;
AreaDataPtr->Flags.Enabled = true;
AreaDataPtr->Flags.Open = false;
AreaDataPtr->SearchTextLength = 0;
AreaDataPtr->SearchTextSize = 0;
HUnlock((Handle) PackDataHnd);
}
//---------------------------------------------------------------------------------
//
// FUNCTION: InitAreaStructs
//
//---------------------------------------------------------------------------------
OSErr InitAreaStructs(AreaPtr AreaDataPtr, Rect* AreaRect, PackHnd PackDataHnd)
{
OSErr err;
GetPort(&(AreaDataPtr->AreaGrafPort));
AreaDataPtr->SearchTextHandle = (XHANDLE)NewHandle(0);
err = MemError();
if (AreaDataPtr->SearchTextHandle)
{
BlockMove(AreaRect,&AreaDataPtr->AreaRect,sizeof(Rect));
InitAreaPICT(AreaDataPtr);
err = InitAreaText(AreaDataPtr);
if (err == noErr)
err = InitAreaList(AreaDataPtr,PackDataHnd);
}
return err;
}
//---------------------------------------------------------------------------------
//
// FUNCTION: InitAreaPICT
//
//---------------------------------------------------------------------------------
void InitAreaPICT (AreaPtr AreaDataPtr)
{
PicHandle ThePICT;
ThePICT = GetPicture(AreaDataPtr->CPICTResUp);
if (ThePICT != NULL)
{
AreaDataPtr->PICTRect = (*ThePICT)->picFrame;
OffsetRect(&AreaDataPtr->PICTRect,
-(AreaDataPtr->PICTRect.right),
-(AreaDataPtr->PICTRect.top));
OffsetRect(&AreaDataPtr->PICTRect,
AreaDataPtr->AreaRect.right,
AreaDataPtr->AreaRect.top);
}
}
//---------------------------------------------------------------------------------
//
// FUNCTION: InitAreaText
//
//---------------------------------------------------------------------------------
OSErr InitAreaText(AreaPtr AreaDataPtr)
{
Rect TextDestRect;
CalcTextRect(AreaDataPtr);
BlockMove((const void *)&(AreaDataPtr->TextRect),
(void *)&(TextDestRect),
(Size) sizeof(Rect));
AreaDataPtr->TextTEHnd = TENew(&TextDestRect, &(AreaDataPtr->TextRect));
if (AreaDataPtr->TextTEHnd)
{
HLock((Handle)(AreaDataPtr->TextTEHnd));
(*(AreaDataPtr->TextTEHnd))->crOnly = -1;
(*(AreaDataPtr->TextTEHnd))->txFont = AreaDataPtr->TextFont;
(*(AreaDataPtr->TextTEHnd))->txSize = AreaDataPtr->TextSize;
(*(AreaDataPtr->TextTEHnd))->txFace = AreaDataPtr->TextStyle;
HUnlock((Handle)(AreaDataPtr->TextTEHnd));
}
return MemError();
}
//---------------------------------------------------------------------------------
//
// FUNCTION: InitAreaList
//
//---------------------------------------------------------------------------------
OSErr InitAreaList (AreaPtr AreaDataPtr, PackHnd PackDataHnd)
{
Rect ListViewRect, dataBounds;
Point cSize;
ParameterBlock block;
GrafPtr CurrGrafPort;
FontInfo FntInfo;
SWORD CurrFont,CurrSize,CurrFace;
CalcListRect(AreaDataPtr);
// Make view rectangle for ListManager record
BlockMove (&AreaDataPtr->ListRect, &ListViewRect, sizeof(Rect));
ListViewRect.right -= kScrollBarWidth;
OffsetRect(&ListViewRect, -ListViewRect.left, -ListViewRect.top);
// Setup other info for LNew()
dataBounds.top = dataBounds.left = 0;
dataBounds.right = 1;
dataBounds.bottom = AreaDataPtr->ListRows;
cSize.v = ListViewRect.bottom / AreaDataPtr->ListRows;
cSize.h = ListViewRect.right;
// Wait until the list's window exists (if it doesn't already)
while (!(*PackDataHnd)->ListWindow)
CALL4D(kEX_YIELD_ABSOLUTE,&block);
// Ahhh... Now we can create our ListManager record
AreaDataPtr->ListHnd = LNew(&ListViewRect,&dataBounds,cSize,0,
(*PackDataHnd)->ListWindow,true,false,false,true);
//OK, now, let's make sure the text starts in the right place.
GetPort(&CurrGrafPort);
CurrFont = CurrGrafPort->txFont;
CurrSize = CurrGrafPort->txSize;
CurrFace = CurrGrafPort->txFace;
TextFont(AreaDataPtr->ListFont);
TextSize(AreaDataPtr->ListSize);
TextFace(AreaDataPtr->ListStyle);
GetFontInfo(&FntInfo);
TextFont(CurrFont);
TextSize(CurrSize);
TextFace(CurrFace);
(*(AreaDataPtr->ListHnd))->indent.h = 1;
(*(AreaDataPtr->ListHnd))->indent.v = FntInfo.ascent;
return noErr;
}
//---------------------------------------------------------------------------------
//
// FUNCTION: DeInitAreaData
//
//---------------------------------------------------------------------------------
void DeInitAreaData (AreaHnd AreaDataHnd)
{
AreaPtr AreaDataPtr;
HLock((Handle)AreaDataHnd);
AreaDataPtr = *AreaDataHnd;
if (AreaDataPtr->TextTEHnd)
TEDispose(AreaDataPtr->TextTEHnd);
if (AreaDataPtr->SearchTextHandle)
DisposeHandle((Handle)AreaDataPtr->SearchTextHandle);
if (AreaDataPtr->ListHnd)
LDispose(AreaDataPtr->ListHnd);
HUnlock((Handle)AreaDataHnd);
}
//---------------------------------------------------------------------------------
//
// FUNCTION: GetPackDataHnd
//
//---------------------------------------------------------------------------------
PackHnd GetPackDataHnd(void)
{
ParameterBlock block;
PackHnd PackDataHnd;
ValuePtr value;
block.fName[0] = (SBYTE)11;
block.fName[1] = 'C';
block.fName[2] = 'B';
block.fName[3] = '_';
block.fName[4] = 'P';
block.fName[5] = 'a';
block.fName[6] = 'c';
block.fName[7] = 'k';
block.fName[8] = 'D';
block.fName[9] = 'a';
block.fName[10] = 't';
block.fName[11] = 'a';
block.fName[12] = '\0';
value = (ValuePtr) NewPtr(sizeof(ValueBlock));
block.fH = (XHANDLE)value;
CALL4D(kEX_GET_GLOBALVAR,&block);
PackDataHnd = (PackHnd)(value->uValue.fLongint);
DisposePtr((Ptr) value);
return PackDataHnd;
}